package com.killer.goods.mapper;

import com.killer.goods.entity.Sku;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 * 标准产品单位表 Mapper 接口
 * </p>
 *
 * @author killer
 * @since 2021-08-29
 */
public interface SkuMapper extends BaseMapper<Sku> {

    @Update("update tb_sku set num=num-#{num},sale_num=sale_num+#{num} where id=#{id} and num>=#{num}")
    int changeInventoryAndSaleNum(@Param("id") Long id,@Param("num") Integer num);
}
